package com.ckk.eurekaclient.exception;

import com.ckk.eurekaclient.constants.ErrorCode;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 自定义异常类
 *
 * @author momo
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class UnCheckedException extends RuntimeException implements ExceptionType {

    private int code;
    private String errorMsg;

    public UnCheckedException(String msg) {
        this(ErrorCode.STATUS_CODE_ERROR, msg);
    }

    public UnCheckedException(int code, String msg) {
        super(msg);
        this.code = code;
        this.errorMsg = msg;
    }

    public UnCheckedException(ExceptionType e) {
        super();
        this.code = e.getCode();
        this.errorMsg = e.getErrorMsg();
    }
}
